package com.rich.area.controller;

import com.rich.area.service.AddressService;
import com.rich.common.annotation.IngoreResponseAdvice;
import com.rich.common.entity.TbAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Package: com.rich.area.controller
 * @Author: 张dy
 * @Date: Created in 2021/8/13 下午 7:34
 */
@RestController
@RequestMapping("/area")
public class AddressController {

    @Autowired
    private AddressService addressService;

    /**
     * 地区列表(管辖地区)
     * @Author: 张dy
     * @Date: 2021/8/21
     * @Param: [pid]
     */
    @IngoreResponseAdvice
    @PostMapping("/findById")
    public List<TbAddress> findById(@RequestParam("pid") Long pid){
        return addressService.findById(pid);
    }


    /**
     * 地区列表(管辖地区  树形)
     * @Author: 张dy
     * @Date: 2021/8/21
     * @Param: [pid]
     */
    @IngoreResponseAdvice
    @GetMapping("/findTree")
    public List<Map> findTree(){
        return addressService.findTree();
    }


}
